$(document).ready(function() {
	$("#home_content_div").height($(document).height());
	loadNewLetter();
});

function loadNewLetter(){
	$.ajax({
		 type: "GET",
		 url: "NewLettersImageServlet",
		 data: {
			 action : "GETTOP"
			 },
		 dataType: "json",
		 success: function(data){
			 generateNewLetterLayout(data);
		 },
		error : function(xhr, ajaxOptions, thrownError) {
			$("#p_freetext").html('Error while processing '+xhr+" :: "+thrownError);
			 $( "#dialog-message" ).dialog('open');
		}
	});
}

function generateNewLetterLayout(data){
	$("div.div_blog1_inside_1").find("div.lastest_new_text").html('<b>'+data[0].letterHead+'</b><br>'+data[0].desciption);
	$("#img_newsletter1").attr('src', 'NewLettersImageServlet?action=GETIMG&imageId='+data[0].lettersID);
	$("div.div_blog1_inside_2").find("div.lastest_new_text").html('<b>'+data[1].letterHead+'</b><br>'+data[1].desciption);
	$("#img_newsletter2").attr('src', 'NewLettersImageServlet?action=GETIMG&imageId='+data[1].lettersID);
	
}